class Solution {
public:
    int longestPalindrome(string s)
    {
        unordered_map<char, int> hash;
        for (auto ch : s)
        {
            hash[ch]++;
        }
        int ret = 0;
        for (auto i : hash)
        {
            ret += ((i.second / 2) * 2);
        }
        return ret < s.size() ? ret + 1 : ret;
    }
};